package com.px.service;

import com.px.client.ShOrderFeignClient;
import com.px.pojo.ShOrder;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ShOrderServiceImpl implements ShOrderService {

    @Resource
    private ShOrderFeignClient shOrderFeignClient;

    @Override
    public List<ShOrder> selectShOrderList(String orderNo, Integer userId, Integer commodityId, Double minPrice, Double maxPrice, Integer payStatus, String aliTradeNo, Integer currentPageNo, Integer pageSize) throws Exception {
        Integer offSet = (currentPageNo-1)*pageSize;
        return shOrderFeignClient.selectShOrderList(orderNo,userId,commodityId,minPrice,maxPrice,payStatus,aliTradeNo,offSet,pageSize);
    }

    @Override
    public int selectShOrderCount(String orderNo, Integer userId, Integer commodityId, Double minPrice, Double maxPrice, Integer payStatus, String aliTradeNo) throws Exception {
        return shOrderFeignClient.selectShOrderCount(orderNo,userId,commodityId,minPrice,maxPrice,payStatus,aliTradeNo);
    }

    @Override
    public ShOrder selectShOrder(Integer orderId) throws Exception {
        return shOrderFeignClient.selectShOrder(orderId);
    }

    @Override
    public int insertShOrder(ShOrder shOrder) throws Exception {
        return shOrderFeignClient.insertShOrder(shOrder);
    }

    @Override
    public int updateShOrder(ShOrder shOrder) throws Exception {
        return shOrderFeignClient.updateShOrder(shOrder);
    }

    @Override
    public int deleteShOrder(Integer id) throws Exception {
        return shOrderFeignClient.deleteShOrder(id);
    }
}
